home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 1996 April / Software of the Month Club 1996 April.iso / pc / os2 / psutils / cmd / fixwfwps.cmd < prev    next >
Encoding:
Text File  |  1996-02-21  |  858 b   |  36 lines

  1. extproc perl5 -x
  2. #! perl5
  3.  
  4. # fixwfwps: fix Word for windows PostScript for printing.
  5. #
  6. # Copyright (C) Angus J. C. Duggan 1991-1995
  7. # See file LICENSE for details.
  8.  
  9. $nesting = 0;
  10. while (<>) {
  11.    tr/\000-\010\012-\014\016-\037//d;
  12.    foreach (grep($_ ne "", split("\015"))) {
  13.       s!/SVDoc\s+save\s+def!!g;
  14.       s!SVDoc\s+restore!!g;
  15.       if (/^(%!PS-Adobe-\d*\.\d*) EPSF-/ && !$nesting) {
  16.      print "$1\n";
  17.      $wfwepsf = 1;
  18.       } elsif (/^SS\s*$/ && $wfwepsf) {
  19.      print "%%Page: $wfwepsf $wfwepsf\n";
  20.      $wfwepsf++;
  21.      print "$_\n";
  22.       } elsif (/^%MSEPS Preamble/) {
  23.      print "%%BeginDocument: (Included EPSF)\n";
  24.      print "$_\n";
  25.      $nesting++;
  26.       } elsif (/^%MSEPS Trailer/) {
  27.      $nesting--;
  28.      print "$_\n";
  29.      print "%%EndDocument\n";
  30.       } elsif (! /^%%BoundingBox/) {
  31.      print "$_\n";
  32.       }
  33.    }
  34. }
  35. # End of Script
  36.